<?php
	session_start();
	include("load-settings.php");

	if(!isset($_SESSION['user']))
		header("Location: login.php");

	$user = $_SESSION['user'];

	$result = mysql_query("SELECT * FROM user WHERE id = $user");
	$row = mysql_fetch_array($result);

	if($row['type'] == 0)
		header("Location: home.php");

	if(isset($_GET['id']))
	{
		$order_record = mysql_real_escape_string($_GET['id']);

		$result = mysql_query("SELECT * FROM booster_duo WHERE duo_order = $order_record AND active <> 0");
		$row = mysql_fetch_array($result);

		if(mysql_num_rows($result) == 0)
		{
			header("Location: duo_queue_panel.php");
		}

		if($user != $row['booster'])
		{
			header("Location: duo_queue_panel.php");
		}

		mysql_query("UPDATE booster_duo SET active = 0, unclaim_time = ".time()." WHERE id = ".$row['id']) or die(mysql_error());

		header("Location: duo_queue_panel.php");
	}
	else
	{
		header("Location: duo_queue_panel.php");
	}
?>